<template>
    <div class="addStandard">
         <div style="margin-bottom:50px">
            <van-cell-group style="text-align:left">
                <van-field
                    label-class='fw'
                    name="标准名称"
                    v-model="form.fname"
                    label="标准名称:"
                    v-validate="'required'"
                    data-vv-scope="registerForm"
                    :error="errors.has('registerForm.标准名称')"
                    :error-message="errors.first('registerForm.标准名称')"
                    required
                    placeholder="请输入标准名称">
                </van-field>
                <van-field
                    name="委托单位"
                    label="委托单位:"
                    v-validate="'required'"
                    data-vv-scope="registerForm"
                    :error="errors.has('registerForm.委托单位')"
                    :error-message="errors.first('registerForm.委托单位')"
                    required
                    is-link 
                    readonly
                    :value="form.fcustomername" 
                    @click="showFdeptClick">
                </van-field>
                <van-popup 
                    v-model="showFdept" 
                    get-container="body" 
                    position='bottom'
                >
                    <van-picker 
                        title='请选择委托单位' 
                        :columns="columnsCompany"
                        show-toolbar
                        value-key='fname'
                        @cancel="onCancel4fdeptname"
                        @confirm="onConfirm4fdeptname"
                     />
                </van-popup>

                <van-cell is-link title="商品" :value="form.fproductname" @click="showFunctionClick"/>
                <van-popup v-model="showFunction" get-container="body" position='bottom'>
                    <van-picker 
                        title='请选择商品' 
                        :columns="columns"
                        show-toolbar
                        @cancel="onCancel4F"
                        @confirm="onConfirm4F"
                    />
                </van-popup>
            </van-cell-group>
         </div>
         <div class='addStandardBtn' @click="submit">保存</div>
    </div>
</template>

<script>


import { 
    Button
    ,DropdownMenu
    , DropdownItem
    ,Icon 
    ,Field
    ,DatetimePicker
    ,Popup
    ,Cell
    ,CellGroup
    ,Picker
    ,Switch
    ,RadioGroup
    , Radio 
    ,Checkbox
    , CheckboxGroup } from 'vant';
export default {
    name: 'addStandard',
    components: {
        [Icon.name]:Icon,
        [Button.name]:Button,
        [DropdownMenu.name]:DropdownMenu,
        [DropdownItem.name]:DropdownItem,
        [Cell.name]:Cell,
        [CellGroup.name]:CellGroup,
        [Field.name]:Field,
        [DatetimePicker.name]:DatetimePicker,
        [Popup.name]:Popup,
        [Picker.name]:Picker,
        [Switch.name]:Switch,
        [RadioGroup.name]:RadioGroup,
        [Radio.name]:Radio,
        [Checkbox.name]:Checkbox,
        [CheckboxGroup.name]:CheckboxGroup
    },
    data () {
        return {
            form:{
                fcustomerid:'',
                fcustomername:'',
                fproductid:'',
                fproductname:'',
                fname:'',
            },
          
        }
    },
    created(){
    
        
    },
    methods:{
       
        submit(){

        },
        showFdeptClick(){
            this.showFdept = true
        },
        onCancel4fdeptname(val){
            this.showFdept = false
        },
        onConfirm4fdeptname(val){
            this.showFdept = false
        },
    }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
.formTitle{
    line-height: 34px;
    margin-left:16px;
    color: #999
}
.addStandardBtn{
    line-height: 40px;
    width:100%;
    text-align: center;
    position: fixed;
    bottom: 0;
    left:0;
    background-color: #1989fa;
    color:white;  
}
</style>
